<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <title>忘记密码</title>
    <link href="{{asset('vendor/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet">
    <link rel="stylesheet" href="{{asset('css/buz/style.css')}}" />
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="{{asset('js/buz/jquery.min.js')}}"></script>
    <script src="{{asset('vendor/bootstrap/js/bootstrapValidator.js')}}"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="{{asset('vendor/bootstrap/js/bootstrap.min.js')}}"></script>
</head>
<body class="bgwhite">
<div class="yhy-header">
    <div class="yhy-wrapper">
        <a href="javascript:;" class="header-logo">
            <img src="{{asset('image/logo.png')}}" />
        </a>
        <div class="header-txt">忘记密码</div>
    </div>
</div>
<div class="yhy-loginBody">
    <div class="yhy-wrapper bgwhite mt20">
        <div class="pwd-box">
            <div class="pwd-title">请输入您要找回密码的账户名</div>
            <div class="pwd-body">
                <form class="form-horizontal" role="form" id="forgetPhone">
                    <div class="form-group">
                        <label for="firstname" class="col-xs-4 col-sm-2 control-label">用户名：</label>
                        <div class="col-xs-10 col-sm-5 col-md-4 col-lg-4">
                            <input type="text" class="form-control" name="username">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="lastname" class="col-xs-4 col-sm-2 control-label">手机号码：</label>
                        <div class="col-xs-10 col-sm-5 col-md-4 col-lg-4">
                            <input type="text" class="form-control" name="mobile">
                        </div>
                        <div class="col-xs-10 col-sm-4 col-md-4 col-lg-4">
                            <button type="button" class="btn btn-info">发送验证码</button>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-xs-4 col-sm-2 control-label">验证码：</label>
                        <div class="col-xs-10 col-sm-5 col-md-4 col-lg-4">
                            <input type="text" class="form-control" name="code">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="firstname" class="col-sm-2 control-label"></label>
                        <div class="col-xs-10 col-sm-5 col-md-4 col-lg-4">
                            <button type="button" class="btn btn-primary" id="forgetNext">下一步</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    $('#forgetPhone').bootstrapValidator({
        message: '这个值没有被验证',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            username: {
                message: '用户名不能为空',
                validators: {
                    notEmpty: {
                        message: '用户名不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 18,
                        message: '用户名长度必须在6到18位之间'
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_]+$/,
                        message: '用户名只能包含大写、小写、数字和下划线'
                    }
                }
            },
            mobile: {
                message: '手机不能为空',
                validators: {
                    notEmpty: {
                        message: '手机不能为空'
                    },
                    stringLength: {
                        min: 11,
                        max: 11,
                        message: '手机号码为11位'
                    },
                    regexp: {
                        regexp: /^1[3|5|7|8]\d{9}$/gi,
                        message: '请输入正确的手机号码'
                    },
                }
            },
            code: {
                message: '验证码不能为空',
                validators: {
                    notEmpty: {
                        message: '验证码不能为空'
                    },
                    stringLength: {
                        min: 6,
                        max: 6,
                        message: '验证码长度为6位'
                    },
                    regexp: {
                        regexp: /^[0-9]*$/,
                        message: '验证码全为数字'
                    },
                }

            }
        }
    }).on('success.form.bv', function (e) {
        e.preventDefault();
        var $form = $(e.target);
        var bv = $form.data('bootstrapValidator');
        console.log($form.serialize())
        // Use Ajax to submit form data
        //$.post("/Account/Register", $form.serialize(), function (data) {
        //    console.log(data)
        //    if (data.Status == "ok") {
        //        window.location.href = "/Home/Index";
        //    }
        //    else if (data.Status == "error") {
        //        alert(data.Message);
        //    }
        //    else {
        //        alert("未知错误");
        //    }
        //});
        location.href="forget-buzhou2.html";

    });

    $("#forgetNext").click(function(e){
        $('#forgetPhone').bootstrapValidator('validate');
    });
</script>

</html>
